package day5;

import java.io.FileInputStream;
import java.io.FileOutputStream;

public class TestFileOutputStream2 {
	public static void main(String[] args) {
		//视频 文档
		
		// 把刚刚复制图片的代码 复制一遍 a.txt
		FileInputStream in = null;
		FileOutputStream out = null;
		try {
			in = new FileInputStream("E:\\Briup\\workspace\\Test\\src\\day5\\TestFileInputStream.java");
			
			out =new  FileOutputStream("F:\\学习\\a.txt");
		
		  //in.read();   //循环一直全部读完图片位置 in.read == -1
	    int len = -1;
	    byte[] arr = new byte[2048];
	    while((len = in.read(arr))!= -1) {//终止条件 in.read()= -1
	    	 //把文件写道磁盘下的其他地方  此时数组里是图片字节
	    	out.write(arr,0,len);  
	    	out.flush();
	    }} catch (Exception e) {
		  e.printStackTrace();
		  
	  }finally {
		  try {      // 关流
			  in.close();
			  out.close();
		  } catch (Exception e) {
			  e.printStackTrace();
		  }
	  }
	  
	}

	
	  

	}
	

